import React, { Component } from 'react';
// import '../../pages/案例/5css.css'
class Header extends Component {
    state = {
        title: '',
        content: ''
    }
    updateTitle = (e) => {
        this.setState({
            title: e.target.value
        })
    }
    updateContent = (e) => {
        this.setState({
            content: e.target.value
        })
    }
    // .发布
    release = () => {

        const { title, content } = this.state
        this.props.CommentList({ title, content })
        this.setState({
            title: '',
            content: '',
        })
        // console.log(this.props.CommentList);
    }
    render() {
        return (
            <div>
                <div className='header'>
                    <input type="text" placeholder='请输入评论人' value={this.state.title} onChange={this.updateTitle} />
                </div>
                <div className='content'>
                    <textarea name="" id="" cols="30" rows="10" placeholder='请输入评论内容' onChange={this.updateContent}></textarea>
                </div>
                <button onClick={this.release}>发表评论</button>
            </div>
        );
    }
}

export default Header;